function [Zero, polos, Q] = filter_chevyshev (wp, Ap, wa, Aa, n, n_min, Q, filter_type, wpm, wam)

%% calculo epsilon, n(si no fue espesificado) y a
epsilon=sqrt(10^(Ap/10)-1);


if (n == 0)
    switch filter_type
        case 1,
        wan=wa/wp;
        case 2,
        wan=wp/wa;
        case 3,
        wan=(wam-wa)/(wpm-wp);
        case 4,
        wan=(wpm-wp)/(wam-wa);
    end  
    n=ceil(acosh(sqrt(10^(Aa/10)-1)/epsilon)/acosh(wan));
end
if (Q~=0)
    Q2=0;
    n=0;
    while (Q2 <= Q)
    n=n+1;
    Q2=(1/2)*sqrt(1+(1/(tan(pi*(2*n-1)/(2*n))*tan(asinh(1/epsilon)/n)))^2);
    end 
    n=n-1;
end
    
if (n>n_min && n_min~=0)
    n=n_min;
end


a=asinh(1/epsilon)/n;

%% inicializo variables
sigma=zeros(1,n);
w=zeros(1,n);


%% calculo polos
for k=1:n
    titas=(2*k-1)*pi/(2*n);
    sigma(k)=-sin(titas)*sinh(a);
    w(k)=cos(titas)*cosh(a);
end
w0=sqrt(sigma.*sigma + w.*w);

polos=sigma+1i*w;

Q=abs(w0./(2*sigma));

Zero=-1;    %definimos -1 para cuando no hay ceros
end